﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ExcelReadManager
{
    public partial class Form1 : Form
    {
        private String INIT_DIALOG = "读取状态.....";
        private FileReadManager frm;
        private String fpath = String.Empty;
        public Form1()
        {
            InitializeComponent();
            this.reading.Text = this.INIT_DIALOG;
        }

        private void selectFile_Click(object sender, EventArgs e)
        {
            frm = new FileReadManager(this);
            if (frm.getResultDialog)
            {
                this.fpath = frm.getFilePath.Trim();
                this.filepath.Text = frm.getFilePath.Trim();
            }
        }

        private void readFile_Click(object sender, EventArgs e)
        {
            DataTable dt;
            if (frm != null)
            {
                if (frm.getResultDialog)
                {
                    if (this.fpath.Trim() != "")
                    {
                        dt=frm.readEncoMes(this.fpath.Trim());
                        //frm.insertSql(dt);
                        frm.insertEcnoSql(dt);
                    }
                }
            }
        }
    }
}
